home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / include / sun4.md / stdarg.h < prev    next >
C/C++ Source or Header  |  1991-06-11  |  1KB  |  39 lines

  1. /*
  2.  * stdarg.h --
  3.  *
  4.  *    ANSI C macros for handling variable-length argument lists.
  5.  *
  6.  * Copyright 1988 Regents of the University of California
  7.  * Permission to use, copy, modify, and distribute this
  8.  * software and its documentation for any purpose and without
  9.  * fee is hereby granted, provided that the above copyright
  10.  * notice appear in all copies.  The University of California
  11.  * makes no representations about the suitability of this
  12.  * software for any purpose.  It is provided "as is" without
  13.  * express or implied warranty.
  14.  *
  15.  * $Header: /sprite/src/lib/include/sun4.md/RCS/stdarg.h,v 1.2 90/12/07 23:54:59 rab Exp $
  16.  */
  17.  
  18. #ifndef _STDARG_H
  19. #define _STDARG_H
  20.  
  21. #ifndef _VA_LIST
  22. #define _VA_LIST
  23. typedef char *va_list;
  24. #endif
  25.  
  26. #define __va_rounded_size(TYPE)  \
  27.   (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
  28.  
  29. #define va_start(AP, lastarg) \
  30.  (__builtin_saveregs(), (AP) = ((char *)&lastarg + __va_rounded_size(lastarg)))
  31.  
  32. #define va_arg(AP, TYPE)                        \
  33.  ((AP) += __va_rounded_size (TYPE),                    \
  34.   *((TYPE *) ((AP) - __va_rounded_size (TYPE))))
  35.  
  36. #define va_end(list)
  37.  
  38. #endif /* _STDARG_H */
  39.